home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / optivc16 / cdemo.cpp next >
Encoding:
C/C++ Source or Header  |  1999-03-06  |  2.0 KB  |  47 lines

  1. /*************************   CDEMO.CPP   *********************************
  2. *                                                                        *
  3. *                Simple Demo Program for                                 *
  4. *                       C M A T H                                        *
  5. *                                                                        *
  6. *       Copyright 1996-1999 by Martin Sander                             *
  7. *                                                                        *
  8. *       This sample program provides a very basic test                   *
  9. *       for the correct installation of CMATH.                           *
  10. *                                                                        *
  11. **************************************************************************/
  12.  
  13. /*  The include-file search path must contain
  14.     \YourCMATHDirectory\include;
  15.     The library search path must contain
  16.     \YourCMATHDirectory\lib;
  17.     (in addition to the compiler's default settings).
  18.  
  19.     Create a project with the following entries:
  20.     CDEMO.CPP
  21.     CMATHL3.LIB (Borland C++, DOS),
  22.     or CMATHL3W.LIB (Borland C++, Windows 3.x, EasyWin),
  23.     or VCF3W.LIB or CMATHF3W.LIB (Borland C++, Win32, console model;
  24.                             choose static linking and single-thread)
  25.     or OVVCSD.LIB or CMVCSD.LIB (Microsoft Visual C++; Win32 console app;
  26.                             choose single-thread debug)
  27.  
  28.     Additionally, you have to link in the standard run-time libraries
  29.     (BC++ 3.x:            use Options/Linker/Libraries;
  30.      BC++ 4.x, 5.x, etc.: use TargetExpert;
  31.      MSVC:                done automatically)
  32. */
  33.  
  34. #include <newcplx.h>
  35. #include <stdio.h>
  36.  
  37. NEWMATHERR    // this macro has an effect only in BC, 16-bit 
  38. int main( void )
  39. {
  40.     fComplex x, y;
  41.     x = sin( fComplex( 3, 5));
  42.     y = inv( fComplex(0,0));  // will produce an error message
  43.     printf( "x: {%f, %f}\n"
  44.             "y: {%g, %g}\n", x.Re, x.Im, y.Re, y.Im );
  45.     return 0;
  46. }
  47.